{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Using parameters `norm`, `vmain`, `vmax`  in `geomImshow()`\n",
    "\n",
    "You can use parameters `norm`, `vmain`, `vmax` when rendering grayscale images.\n",
    "\n",
    "A grayscale image is specified by 2D array where each element's value \n",
    "represents the luminance of corresponding pixel in the image."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"VE7yHB\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"library\">\n",
       "       if(!window.letsPlotCallQueue) {\n",
       "           window.letsPlotCallQueue = [];\n",
       "       }; \n",
       "       window.letsPlotCall = function(f) {\n",
       "           window.letsPlotCallQueue.push(f);\n",
       "       };\n",
       "       (function() {\n",
       "           var script = document.createElement(\"script\");\n",
       "           script.type = \"text/javascript\";\n",
       "           script.src = \"https://cdn.jsdelivr.net/gh/JetBrains/lets-plot@v3.0.0/js-package/distr/lets-plot.min.js\";\n",
       "           script.onload = function() {\n",
       "               window.letsPlotCall = function(f) {f();};\n",
       "               window.letsPlotCallQueue.forEach(function(f) {f();});\n",
       "               window.letsPlotCallQueue = [];\n",
       "               \n",
       "               \n",
       "           };\n",
       "           script.onerror = function(event) {\n",
       "               window.letsPlotCall = function(f) {};\n",
       "               window.letsPlotCallQueue = [];\n",
       "               var div = document.createElement(\"div\");\n",
       "               div.style.color = 'darkred';\n",
       "               div.textContent = 'Error loading Lets-Plot JS';\n",
       "               document.getElementById(\"VE7yHB\").appendChild(div);\n",
       "           };\n",
       "           var e = document.getElementById(\"VE7yHB\");\n",
       "           e.appendChild(script);\n",
       "       })();\n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%useLatestDescriptors\n",
    "%use lets-plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "// Generate 2D arrays. \n",
    "// First two arrays both contain float numbers but have different range of values.\n",
    "// The 3rd array contains int-s.\n",
    "fun linspace(start: Double, end: Double, count: Int): List<Number> {\n",
    "    val step = (end - start) / (count - 1)\n",
    "    return mutableListOf<Double>() + \n",
    "        start + (1 .. (count - 2)).map { i -> start + i * step } + end\n",
    "}\n",
    "\n",
    "val arr_f0 = RasterData.create(listOf(linspace(0.3, 0.7, 30)))\n",
    "val arr_f1 = RasterData.create(listOf(linspace(30.0, 170.0, 30)))\n",
    "val arr_i = RasterData.create(listOf(linspace(30.0, 170.0, 30).map { it.toInt() }))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "// Setup suitable plot options for the demo.\n",
    "val p = (letsPlot() + ggsize(450, 60) + geomRect(xmin=-0.5, ymin=-0.5, xmax=29.5, ymax=0.5, color=\"black\", alpha=0) + \n",
    "coordCartesian() + themeClassic() + theme(axis=\"blank\"))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Image normalization\n",
    "\n",
    "By default, `geomImshow()` applies a linear scaling to transform data values to range [0-255]."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"sOuOAe\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"cartesian\",\n",
       "\"flip\":false\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":450.0,\n",
       "\"height\":60.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"color\":\"black\",\n",
       "\"alpha\":0.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"rect\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"show_legend\":false,\n",
       "\"href\":\"\",\n",
       "\"geom\":\"image\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"axis\":\"blank\"\n",
       "}\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"sOuOAe\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "   <div id=\"KvsnL3\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"cartesian\",\n",
       "\"flip\":false\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":450.0,\n",
       "\"height\":60.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"color\":\"black\",\n",
       "\"alpha\":0.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"rect\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"show_legend\":false,\n",
       "\"href\":\"\",\n",
       "\"geom\":\"image\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"axis\":\"blank\"\n",
       "}\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"KvsnL3\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "   <div id=\"s60Z2i\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"cartesian\",\n",
       "\"flip\":false\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":450.0,\n",
       "\"height\":60.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"color\":\"black\",\n",
       "\"alpha\":0.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"rect\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"show_legend\":false,\n",
       "\"href\":\"\",\n",
       "\"geom\":\"image\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"axis\":\"blank\"\n",
       "}\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"s60Z2i\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "(p + geomImshow(arr_f0)).show()\n",
    "(p + geomImshow(arr_f1)).show()\n",
    "(p + geomImshow(arr_i)).show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## \n",
    "\n",
    "You can disable image normalization using the `norm` parameter."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"tGOa0j\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"cartesian\",\n",
       "\"flip\":false\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":450.0,\n",
       "\"height\":60.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"color\":\"black\",\n",
       "\"alpha\":0.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"rect\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"show_legend\":false,\n",
       "\"href\":\"\",\n",
       "\"geom\":\"image\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"axis\":\"blank\"\n",
       "}\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"tGOa0j\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "   <div id=\"FYrjbh\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"cartesian\",\n",
       "\"flip\":false\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":450.0,\n",
       "\"height\":60.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"color\":\"black\",\n",
       "\"alpha\":0.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"rect\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"show_legend\":false,\n",
       "\"href\":\"\",\n",
       "\"geom\":\"image\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"axis\":\"blank\"\n",
       "}\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"FYrjbh\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "   <div id=\"dNrgRO\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"cartesian\",\n",
       "\"flip\":false\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":450.0,\n",
       "\"height\":60.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"color\":\"black\",\n",
       "\"alpha\":0.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"rect\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"show_legend\":false,\n",
       "\"href\":\"\",\n",
       "\"geom\":\"image\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"axis\":\"blank\"\n",
       "}\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"dNrgRO\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "(p + geomImshow(arr_f0, norm=false)).show()\n",
    "(p + geomImshow(arr_f1, norm=false)).show()\n",
    "(p + geomImshow(arr_i, norm=false)).show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Define normalization range using `vmin, vmax` parameters"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"v2qoNh\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"cartesian\",\n",
       "\"flip\":false\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":450.0,\n",
       "\"height\":60.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"color\":\"black\",\n",
       "\"alpha\":0.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"rect\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"show_legend\":false,\n",
       "\"href\":\"\",\n",
       "\"geom\":\"image\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"axis\":\"blank\"\n",
       "}\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"v2qoNh\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "   <div id=\"EzynXM\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"cartesian\",\n",
       "\"flip\":false\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":450.0,\n",
       "\"height\":60.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"color\":\"black\",\n",
       "\"alpha\":0.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"rect\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"show_legend\":false,\n",
       "\"href\":\"\",\n",
       "\"geom\":\"image\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"axis\":\"blank\"\n",
       "}\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"EzynXM\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "   <div id=\"auO1ME\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"cartesian\",\n",
       "\"flip\":false\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":450.0,\n",
       "\"height\":60.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"color\":\"black\",\n",
       "\"alpha\":0.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"rect\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"show_legend\":false,\n",
       "\"href\":\"\",\n",
       "\"geom\":\"image\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"axis\":\"blank\"\n",
       "}\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"auO1ME\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "// Set upper limit less than the data max value.\n",
    "(p + geomImshow(arr_f0, vmax=.5)).show()\n",
    "(p + geomImshow(arr_f1, vmax=100)).show()\n",
    "(p + geomImshow(arr_i, vmax=100)).show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "   <div id=\"BYNBOx\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"cartesian\",\n",
       "\"flip\":false\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":450.0,\n",
       "\"height\":60.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"color\":\"black\",\n",
       "\"alpha\":0.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"rect\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"show_legend\":false,\n",
       "\"href\":\"\",\n",
       "\"geom\":\"image\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"axis\":\"blank\"\n",
       "}\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"BYNBOx\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "   <div id=\"ckp9Ie\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"cartesian\",\n",
       "\"flip\":false\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":450.0,\n",
       "\"height\":60.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"color\":\"black\",\n",
       "\"alpha\":0.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"rect\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"show_legend\":false,\n",
       "\"href\":\"\",\n",
       "\"geom\":\"image\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"axis\":\"blank\"\n",
       "}\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"ckp9Ie\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "   <div id=\"1rJarY\"></div>\n",
       "   <script type=\"text/javascript\" data-lets-plot-script=\"plot\">\n",
       "       (function() {\n",
       "           var plotSpec={\n",
       "\"mapping\":{\n",
       "},\n",
       "\"coord\":{\n",
       "\"name\":\"cartesian\",\n",
       "\"flip\":false\n",
       "},\n",
       "\"ggsize\":{\n",
       "\"width\":450.0,\n",
       "\"height\":60.0\n",
       "},\n",
       "\"kind\":\"plot\",\n",
       "\"scales\":[],\n",
       "\"layers\":[{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"color\":\"black\",\n",
       "\"alpha\":0.0,\n",
       "\"position\":\"identity\",\n",
       "\"geom\":\"rect\",\n",
       "\"data\":{\n",
       "}\n",
       "},{\n",
       "\"ymin\":-0.5,\n",
       "\"mapping\":{\n",
       "},\n",
       "\"stat\":\"identity\",\n",
       "\"xmin\":-0.5,\n",
       "\"ymax\":0.5,\n",
       "\"xmax\":29.5,\n",
       "\"show_legend\":false,\n",
       "\"href\":\"\",\n",
       "\"geom\":\"image\",\n",
       "\"data\":{\n",
       "}\n",
       "}],\n",
       "\"theme\":{\n",
       "\"name\":\"classic\",\n",
       "\"axis\":\"blank\"\n",
       "}\n",
       "};\n",
       "           var plotContainer = document.getElementById(\"1rJarY\");\n",
       "           window.letsPlotCall(function() {{\n",
       "               LetsPlot.buildPlotFromProcessedSpecs(plotSpec, -1, -1, plotContainer);\n",
       "           }});\n",
       "       })();    \n",
       "   </script>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "// Set limits wider than the data entire range.\n",
    "(p + geomImshow(arr_f0, vmin=.4, vmax=.6)).show()\n",
    "(p + geomImshow(arr_f1, vmin=70, vmax=120)).show()\n",
    "(p + geomImshow(arr_i, vmin=50, vmax=150)).show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Kotlin",
   "language": "kotlin",
   "name": "kotlin"
  },
  "language_info": {
   "codemirror_mode": "text/x-kotlin",
   "file_extension": ".kt",
   "mimetype": "text/x-kotlin",
   "name": "kotlin",
   "nbconvert_exporter": "",
   "pygments_lexer": "kotlin",
   "version": "1.7.20-dev-1299"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
